package com.example.task;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Deacription TODO
 * @Author baohuajie
 * @Date 2021/1/16 17:32
 * @Version 1.0
 **/
@Slf4j
@Component
public class Task4 implements JavaDelegate {

    @Autowired
    private TaskService taskService;
    @Autowired
    private RuntimeService runtimeService;

    @Override
    public void execute(DelegateExecution execution) {
        log.info("Task4 star,thread:{}", Thread.currentThread().getName());
        log.info("Task4 instanceId:{}", execution.getProcessInstanceId());
        log.info("Task4 executionId:{}", execution.getId());
        try {
            Thread.sleep(2000);
            execution.setVariable("devicelist_state", "C");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("Task4 end");
    }
}
